<script setup lang="ts">
import { onBeforeMount, ref } from 'vue'
let date = new Date()
let year = ref(date.getFullYear())
let month = ref((date.getMonth() + 1) <= 9 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
let day = ref(date.getDate() < 10 ? '0' + date.getDate() : date.getDate())
let weatherData = ref<any>(JSON.parse(localStorage.getItem('weather') + ''))
</script>

<template>
    <div class="container">
        <div class="top">
            <div class="left">
                <span style="font-size:30px">{{ day }}</span>
                <span>&nbsp;{{ month }}.{{ year }}</span>
            </div>
            <div class="right" v-if="weatherData">
                {{ weatherData.city }} ·
                {{ weatherData.info }}
                {{ weatherData.temperature }}℃
            </div>
        </div>
    </div>
</template>

<style lang="less" scoped>
.container {
    position: fixed;
    background: #fff;
    top: 0;
    width: 100%;
    .top {
        .left {
            margin: 5px 10px;
        }
        display: flex;
        justify-content: space-between;
        .right {
            color: #666;
            margin: 5px 10px;
            line-height: 50px;
        }
    }
}
</style>